package com.ggh.jinjilive.views.faceunity.beauty;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.ggh.jinjilive.R;
import com.ggh.jinjilive.listener.AddOnClickListener;
import com.ggh.jinjilive.views.faceunity.FURenderer;

public class FaceUnityView extends LinearLayout {
    private Context mContext;
    private BeautyControlView beautyControlView;


    public FaceUnityView(Context context) {
        super(context);
        this.mContext = context;
    }
    public FaceUnityView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        this.mContext = context;
        initView();
    }

    public FaceUnityView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mContext = context;
        initView();
    }

    private void initView() {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.layout_faceunity, this);
        beautyControlView = view.findViewById(R.id.beauty_control_view);
        findViewById(R.id.ll_beauty).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(null != addOnClickListener){
                    addOnClickListener.onSkipClicked("隐藏");
                }
            }
        });
    }


    public void setModuleManager(FURenderer fuRenderer) {
        beautyControlView.setFaceBeautyManager(fuRenderer.getFaceBeautyModule());
    }

    private AddOnClickListener addOnClickListener;
    public void setAddOnClickListener(AddOnClickListener addOnClickListener){
        this.addOnClickListener = addOnClickListener;
    }


}
